import 'package:flutter/material.dart';

class PublishRulesPage extends StatelessWidget {
  const PublishRulesPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xff161616),
      appBar: AppBar(
        backgroundColor: Color(0xff161616),
        leading: IconButton(
          icon: const Icon(Icons.arrow_back, color: Colors.white),
          onPressed: () => Navigator.pop(context),
        ),
        title: // 发布规则
        const Text(
            "发布规则",
            style: TextStyle(
                color:  Color(0xffffffff),
                fontWeight: FontWeight.w500,
                fontStyle:  FontStyle.normal,
                fontSize: 18.0
            )
        ),
      ),
      body: const PublishRulesContent(),
    );
  }
}

class PublishRulesContent extends StatelessWidget {
  const PublishRulesContent({super.key});

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            _buildRulesList(),
            const SizedBox(height: 24),
            _buildTipsList(),
          ],
        ),
      ),
    );
  }

  Widget _buildRulesList() {
    final rules = [
      "用户须年满18周岁，具有完全民事行为能力，符合所在地区的法律法规，不满足条件的请主动退出；",
      "遵循自由、自愿原则，视频需在被拍摄人允许的情况下上传，如有必要，请对视频中的人打码处理；",
      "禁止上传幼女、兽交、枪支、政治等话题及侵犯他人隐私的内容；",
      "禁止在视频中添加个人联系方式、广告、水印等；",
      "上传的视频将由平台进行审核，48小时内反馈审核结果。",
    ];

    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        ...rules.asMap().entries.map((entry) {
          return Padding(
            padding: const EdgeInsets.only(bottom: 2),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Opacity(
                  opacity : 0.800000011920929,
                  child: Text(
                    "${entry.key + 1}、",
                    style:  const TextStyle(
                      color: Colors.white,
                      fontSize: 15,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
                const SizedBox(width: 4),
                Expanded(
                  child: Text(
                    entry.value,
                    style:  TextStyle(
                      color: Colors.white.withOpacity(0.8),
                      fontSize: 15,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
              ],
            ),
          );
        }).toList(),
      ],
    );
  }

  Widget _buildTipsList() {
    final tips = [
      "上传视频越高清、真实，越容易通过；",
      "上传的文字富有故事性或趣味性，有看点；",
      "视频大小不超过500M，视频时长不低于10S。",
    ];

    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
         Text(
          "过审小窍门",
          style: TextStyle(
            color: Colors.white.withOpacity(0.8),
            fontSize: 16,
            fontWeight: FontWeight.bold,
          ),
        ),
        const SizedBox(height: 2),
        ...tips.asMap().entries.map((entry) {
          return Padding(
            padding: const EdgeInsets.only(bottom: 2),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  "${entry.key + 1}、",
                  style:  TextStyle(
                    color: Colors.white.withOpacity(0.8),
                    fontSize: 15,
                    fontWeight: FontWeight.w600,
                  ),
                ),
                const SizedBox(width: 4),
                Expanded(
                  child: Text(
                    entry.value,
                    style:  TextStyle(
                      color: Colors.white.withOpacity(0.8),
                      fontSize: 15,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
              ],
            ),
          );
        }).toList(),
      ],
    );
  }
}
